Skip to content

optimize PathIndex walk for large repos - #5

Merged
xobotyi merged 1 commit into
mainfrom
dev-master
May 26, 2026
Merged

optimize PathIndex walk for large repos#5
xobotyi merged 1 commit into
mainfrom
dev-master

Conversation

@xobotyi

@xobotyi xobotyi commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Skip .git/ directories during filesystem walk (WALK_EXCLUDE_DIRS constant)
  • Skip line counting for ~100 known binary extensions (BINARY_EXTENSIONS constant) -- stat-only indexing, no fd opened

Context

Dagor repo has 3.5M files. PathIndex opened every file for line counting, causing session_start to exceed MCP tool timeout. Binary-extension files (images, audio, models, shaders, game assets) now get stat-only indexing -- they remain in the index for find_files and grep but skip the expensive LineIter scan.

Test plan

  • All 268 tests pass
  • vp check clean (formatting, lint, types)
  • Verify on a large repo that session_start completes within timeout

PathIndex walked every file including .git internals and
opened every file for line counting. On repos with millions
of files (e.g. game engines with binary assets), session_start
exceeded MCP tool timeout.

Two configurable constants control the behavior:
- WALK_EXCLUDE_DIRS: directories never descended into (.git)
- BINARY_EXTENSIONS: ~100 extensions that get stat-only
  indexing (size captured, marked isBinary, no fd opened)

Binary-extension files remain in the index for find_files
and grep -- only line counting is skipped.
@xobotyi
xobotyi merged commit 70fafc1 into main May 26, 2026
5 checks passed
@xobotyi
xobotyi deleted the dev-master branch May 26, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant